package edu.upf.opencities.dao.connection;

import java.util.List;

import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.XMLGregorianCalendar;

import edu.upf.opencities.datamodel.OSNEntry;
import edu.upf.opencities.datamodel.OSNService;

public interface CassandraServiceConnector {

	/**
	 * 
	 * Cassandra connection method
	 */
	public void connect();
	
	/**
	 * 
	 * Cassandra disconnection method
	 */
	public void disconnect();
	
	/**
	 * Cassandra register service method
	 * 
	 * @param IdOSNService
	 * @param mail
	 * @param serviceName
	 * @param servicePassword
	 * @param owner
	 * @param description
	 * @param updatePeriod
	 * @param section
	 * @param longitude
	 * @param latitude
	 * @param tagList
	 */
	public String registerService( String mail, String serviceName, 
			String servicePassword, String owner, String description, 
			String updatePeriod, String section, 
			String latitude, String  longitude, List<String> tagList );
	

	/**
	 * Cassandra register service in a section method
	 * 
	 * @param idOSNService
	 * @param section
	 */
	public void registerServiceInSection( String idOSNService, String section);
	
	/**
	 * Cassandra delete service from a section method
	 * 
	 * @param idOSNService
	 * @param section
	 */
	public void deleteServiceFromSection( String idOSNService, String section);
	
	/**
	 * Cassandra register service in a tag method
	 * 
	 * @param idOSNService
	 * @param tag
	 */
	public void registerServiceInTag( String idOSNService, String tag);
	
	/**
	 * Cassandra delete service from tag method
	 * 
	 * @param idOSNService
	 * @param tag
	 */
	public void deleteServiceFromTag( String idOSNService, String tag);
	
	/**
	 * Cassandra register tag in a service method
	 * 
	 * @param tag
	 * @param idOSNService
	 */
	public void registerTagInService ( String tag, String idOSNService );
	
	/**
	 * Cassandra delete tag from a service method
	 * 
	 * @param tag
	 * @param idOSNService
	 */
	public void deleteTagFromService ( String tag, String idOSNService );
	
	/**
	 * Cassandra get tags from service method
	 * 
	 * @param idOSNService
	 * @return
	 */
	public List<String> getTagsByService (String idOSNService);
	
	/**
	 * Cassandra delete service method
	 * 
	 * @param idOSNService
	 */
	public void deleteService( String idOSNService );
	
	/**
	 * Cassandra get service method
	 * 
	 * @param IdOSNService
	 * @return
	 */
	public OSNService getService ( String idOSNService );
	
	/**
	 * Cassandra get All services method
	 * 
	 * @return
	 */
	public List<OSNService> getAllServices();
	
	/**
	 * Cassandra get services method by section
	 * 
	 * @return
	 */
	public List<OSNService> getServicesBySection( String section );
	
	/**
	 * Cassandra get services method by tag
	 * 
	 * @return
	 */
	public List<OSNService> getServicesByTag( String tag );
	
	
	/**
	 * Cassandra get services method by mail owner
	 * 
	 * @return
	 */
	public List<OSNService> getServicesByMail( String mail );
	
	/**
	 * Cassandra add entry method
	 * 
	 * @param IdOSNService
	 * @param IdOSNEntry
	 * @param timeStamp
	 * @param value
	 */
	public String addEntry( String idOSNService, XMLGregorianCalendar timeStamp, 
			String value, String longitude, String latitude );
	
	/**
	 * Cassandra delete entry method
	 * 
	 * @param IdOSNEntry
	 */
	public void deleteEntry( String IdOSNEntry );
	
	/**
	 * Cassandra delete entries from service method
	 * 
	 * @param idOSNService
	 */
	public void deleteEntriesFromService (String idOSNService);
	
	/**
	 * Cassandra get entries from service method
	 * 
	 * @param idOSNService
	 * @return
	 */
	
	public List<OSNEntry> getEntriesFromService( String idOSNService, int numEntries );
	
	
	
	/**
	 * Cassandra add last Entry method
	 * 
	 * @param idOSNService
	 * @param idOSNEntry
	 */
	public void addLastEntry(String idOSNService, String idOSNEntry);
	
	/**
	 * Cassandra get Entry method
	 * 
	 * @param idOSNEntry
	 * @return
	 */
	public OSNEntry getEntry( String idOSNEntry );
	
	/**
	 * Cassandra get Last entry method
	 * 
	 * @param idOSNService
	 * @return
	 */
	public OSNEntry getLastEntry( String idOSNService );
	
	/**
	 * Cassandra get entries between 2 dates method
	 * 
	 * @param idOSNService
	 * @param startDate
	 * @param endDate
	 * @return
	 */
	public List<OSNEntry> getEntriesBetween2Dates( String idOSNService, 
			String startDate, String endDate );
	
	/**
	 * Cassandra add binding method
	 * 
	 * @param idOSNService
	 * @param mail
	 */
	public void addBinding(String idOSNService, String mail);
	
	/**
	 * Cassandra get binding method
	 * 
	 * @param idOSNService
	 * @return
	 */
	public String getBinding(String idOSNService);
	
	/**
	 * Cassandra delete binding method
	 * 
	 * @param idOSNService
	 * @param mail
	 */
	public void deleteBinding(String idOSNService, String mail);
	
	/**
	 * Cassandra add Service Entries  binding method
	 * 
	 * @param idOSNService
	 * @param idOSNEntry
	 */
	public void addServiceEntriesBinding(String idOSNService, String idOSNEntry);
	
	/**
	 * Cassandra get Service Entries binding method
	 * 
	 * @param idOSNService
	 * @return
	 */
	public List<String> getSeviceEntriesBinding(String idOSNService);
	
	/**
	 * Cassandra get Service Entries binding with limit method
	 * 
	 * @param idOSNService
	 * @return
	 */
	public List<String> getSeviceEntriesBinding(String idOSNService, int numOfEntries);
	
	/**
	 * Cassandra delete Service Entries binding method
	 * 
	 * @param idOSNService
	 */
	public void deleteServiceEntriesBinding(String idOSNService);
	
	/**
	 * Cassandra add Twitter user method
	 * 
	 * @param idOSNService
	 * @param consumerKey
	 * @param consumerSecret
	 * @param token
	 * @param tokenSecret
	 */
	public void addTwitter (String idOSNService, 
			String consumerKey, String consumerSecret,
			String token, String tokenSecret);
	
	/**
	 * Cassandra get Twitter method
	 * 
	 * @param idOSNService
	 * @return
	 */
	public OSNService getTwitter (String idOSNService);
	
	/**
	 * Cassandra delete Twitter method
	 * 
	 * @param idOSNService
	 */
	public void deleteTwitter(String idOSNService);
	
	
	/**
	 * Cassandra login service method
	 * 
	 * @param idOSNService
	 * @param servicePassword
	 * @return
	 */
	public boolean loginService(String idOSNService, String servicePassword);
}
